package my.dao;

import java.sql.SQLException;
import java.util.List;

import my.bean.User;

public interface IUserDao {
	/**
	 * add an user into USER
	 * @param user
	 * @return the count of operation successfully insert into USER
	 * @throws SQLException
	 */
	public int addUser(User user) throws SQLException;

	/**
	 * delete an user by user's id
	 * @param id
	 * @return the count of operation successfully delete from USER
	 * @throws SQLException
	 */
	public int deleteUserById(int id) throws SQLException;

	/**
	 * modify the user's base message without password 
	 * @param user
	 * @return the count of operation successfully modify
	 * @throws SQLException
	 */
	public int modifyBaseMessage(User user) throws SQLException;

	/**
	 * modify the user's password for given id and new password only
	 * @param id
	 * @param newPassword
	 * @return the count of operation successfully modify
	 * @throws SQLException
	 */
	public int modifyPasswordById(int id, String newPassword) throws SQLException;

	/**
	 * find all user
	 * @return a list off all user
	 */
	public List<User> findAll();

	/**
	 * find a list of user where user's account like 'account' 
	 * @param account
	 * @return a list of user
	 */
	public User findByAccount(String account);

	/**
	 * find an user by user's id
	 * @param id
	 * @return an user object
	 */
	public User findByUserId(int id);
	
	/**
	 * find an user by account and password
	 * @param account
	 * @param password
	 * @return an user object
	 */
	public User findByUserAccountAndPassword(String account,String password);
}
